// packageI/new_blind_box/bindBoxCard/index.js
Component({
  options: {
    styleIsolation: 'shared' 
  },
  properties: {
    homeIsShow:{
      type: Boolean,
      value: false,
    },
    goodsIsShow: {
      type: Boolean,
      value: true,
    },
    allDataList: {
      type: null,
      value: {},
    },
    activeIndex: {
      type: null,
      value: 0,
    },
    timeShow: {
      type: Boolean,
      value: true,
    }
  },
  lifetimes: {
    attached() {
      this.audioCtx = wx.createInnerAudioContext("myAudio");
      this.setData({
        now: String(Date.parse(new Date())).substring(0, 10),
        audio_link: this.data.allDataList.audio
      });

      // 在组件实例刚刚被创建时执行
    },
  },
  data: {
    isShow: false,
    timeData: {},
    now: "",
    audio_link: "",
    audioAction: {
      method: ''
    },
  },
  methods: {
    // 点击播放
    clickMusick(e) {
      if(e.currentTarget.dataset.value) {
        this.setData({
          ['audioAction.method']: 'play'
        });
      }else {
        this.setData({
          ['audioAction.method']: 'pause'
        });
      }
      this.setData({
        isShow: e.currentTarget.dataset.value
      });
    },
    onChangeTime(e) {
      this.setData({
        timeData: e.detail,
      });
    }
  }
})